<?php
require 'TVB/pms/pdes/common/bootstrap.php';

empty($_REQUEST['date']) && exit('error');

getList();

/**
 *
 */
function getList()
{
	$page	=	1;
	$length =	10;

	$type		=	'audit_log';
	$orderBy	=	NULL;
	$orderXsc	=	' DESC ';
    $date       =   date("Y-m-d");

    isset($_REQUEST['date'])    &&  $date       =   trim($_REQUEST['date']);
	isset($_REQUEST['page'])	&&	$page		=	trim($_REQUEST['page']);
	isset($_REQUEST['orderby'])	&&	$orderBy	=	trim($_REQUEST['orderby']);
	isset($_REQUEST['orderxsc'])&&	$orderXsc	=	trim($_REQUEST['orderxsc']);
    isset($_REQUEST['rows'])    &&  $length     =   trim($_REQUEST['rows']);


	$findRelation	=	Model::parseFindRelation($type);
	$list	=	new $type();

	if ($page <1)	$page	=	1;
	$start	=	($page -1) * $length;

	$ret	=	$list->getResultList($findRelation, $date, $start, $length);
	empty($ret) &&  $ret    =   array();
	echo	json_encode($ret);

}
?>
